<template>
	<view class="page">
		<view class="tx_cont">
			<text class="tx_money">提现金额</text>
			<view class="tx_box">
				<view class="biaoshi">¥</view>
				<u-input type="number" height="80" placeholder-style="font-size: 60rpx;line-height:80rpx;" placeholder="请输入提现金额" maxlength="10" v-model.trim ="change_money" />
				<!-- <view class="min">最小提现额度￥1</view> -->
			</view>
			<text class="tx_yue">账户余额<text style="font-weight: bold;"> ¥{{moeny}}</text>
				<!-- <text v-if="moeny != 0" class="min" @tap="totalX">全部提现</text> -->
				<text class="min">最小提现额度 ¥{{min}}</text>
			</text>
		</view>
		<view class="tx_main">
			<text class="tx_choose">到账账户</text>
			<view class="payMain">
				<!-- <view class="tx_mainBox" :class="tabCurrentIndex == 1?'act':''" @tap="get_type" :data-index="1">
					<text class="tx_name">支付宝</text>
				</view> -->
				<view class="tx_mainBox" :class="tabCurrentIndex == 2?'act':''" @tap="get_type" :data-index="2">
					<image src="/static/talent/home/share1.png"></image>
					<text class="tx_name">微信</text>
					<image class="select" src="/static/talent/user/select.png"></image>
				</view>
			</view>
		</view>
		<view class="tx_final">
			<text class="tx_pb">注：提现申请将在两天内审批到账</text>
		</view>
		<view class="tx_btn" @tap="tijiao">
			提交审核
		</view>
		<fu-popup v-model="showPopup" mode="center" width="500rpx" height="100px">
			<view class="fu-flex-center fu-flex-vcenter padding">{{fast_detaile||''}}</view>
		</fu-popup>
		<pay-keyboard :show_key="show_key" @hideFun="hideFun" @getPassword="getPassword"></pay-keyboard>
		<fu-notwork></fu-notwork>
	</view>
</template>

<script>
	// import ssPaymentPassword from '@/components/fu-payment-password/sanshui-payment-password'
	// import payKeyboard from '@/components/keyboard/keyboard.vue'
	export default {
		components: {
			// ssPaymentPassword,
			// payKeyboard
		},
		data() {
			return {
				tabCurrentIndex: 1,
				moeny: '',
				account_name: '',
				account: '',
				change_money: '',
				is_click: false,
				show_key: false,
				min: 100,
				showPopup: false,
				fast_detaile: '',
				is_true: true,
				type: '',
				caddie_info: ''
			};
		},
		onLoad(option) {
			this.type = option.type
			this.getBatInfo()
		},
		
		methods: {
			// 获取余额
			getBatInfo() {
				this.$api.post(global.apiUrls.batWork, {
					
				}).then(res => {
					uni.hideLoading()
					if(res.data.code ==1) {
						this.caddie_info = res.data.data.caddie_info
						this.moeny = (Math.round(this.caddie_info.user_money*100)/100).toFixed(2)
					} else {
						this.$message.info(res.data.msg)
					}
				})
			},
			totalX() {
				console.log(11)
				this.change_money = this.moeny
				this.$forceUpdate(); 
			},
			tijiao() {
				if (!this.change_money) {
					this.$message.info('请输入提现金额');
					return false;
				}
				if (Number(this.change_money) < Number(this.min)) {
					this.$message.info('最小提现金额为' + this.min + '元');
					return false;
				}
				let x1 = this.change_money.toString().indexOf('.') + 1;   //小数点的位置
				if (x1 != 0) {
					var y1 = this.change_money.toString().length - x1;  //小数的位数
					if(y1 > 2){
					    this.$message.info('请输入正确金额')
						return false
					}
				}

				if (Number(this.change_money) > Number(this.moeny)) {
					this.$message.info('可提现余额不足');
					return false;
				}
				uni.navigateTo({
				 	url: '/pages/user/wallet/withdraw-password?change_money=' + this.change_money
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	.page {
		min-height: 100vh;
		background: #f2f2f1;
		color: #333333;
	}
	.uni-input-placeholder {
		color: #999
	}

	.fu-flex-center {
		background: $uni-text-color-inverse;
		justify-content: end !important;
	}

	.tx_btn {
		font-size: 32upx;
		color: white;
		line-height: 88upx;
		text-align: center;
		position: fixed;
		bottom: 40upx;
		left: 32upx;
		width: 686rpx;
		height: 88rpx;
		background: #006747;
		opacity: 1;
		border-radius: 8rpx;
	}

	.tx_final {
		width: 100%;
		height: auto;
		overflow: hidden;
		padding: 0 48upx;

		text {
			display: block;
			margin-top: 24upx;
			font-size: 24upx;
			color: #999999;

			text {
				color: $fu-main-color;
				display: inline-block;
				margin-left: 6upx;
			}
		}
	}

	.tx_main {
		width: 100%;
		height: auto;
		overflow: hidden;
		padding: 32upx 32upx 16upx 48upx;
		background: white;
		margin-top: 20upx;

		.payMain {
			margin: 20px 0;
			display: flex;
			justify-content: space-between;
		}

		.tx_mainBox {
			width: 300rpx;
			height: 80rpx;
			background: rgba(255, 255, 255, 0);
			border: 2rpx solid #006747 !important;
			opacity: 1;
			border-radius: 8rpx;
			text-align: center;
			line-height: 80rpx;
			position: relative;

			.tx_name {
				display: inline-block;
				// line-height: 100upx;
				font-size: 32upx;
				color: #333;
				text-align: center;
			}
			image {
				width: 32rpx;
				height: 32rpx;
				vertical-align: middle;
				transform: translateY(-4rpx);
				margin-right: 16rpx;
			}
			.select {
				width: 48rpx;
				height: 48rpx;
				position: absolute;
				top: 2rpx;
				right: -16rpx;
				
			}

			// &.act {
			// 	border: 1px solid $fu-main-color;

			// 	.tx_name {
			// 		color: $fu-main-color;
			// 	}
			// }
		}

		.act .icon-yuanquan:before {
			content: "\E655";
			color: $fu-main-color;
		}
	}

	.tx_cont {
		width: 100%;
		height: auto;
		overflow: hidden;
		background: white;
		padding-left: 18rpx;
		.tx_money {
			font-size: 30upx;
			display: block;
			margin-top: 30upx;
			padding: 0 30upx;
		}

		.tx_box {
			width: 100%;
			height: auto;
			overflow: hidden;
			padding: 0 30upx 32upx 30upx;
			margin-top: 20upx;
			position: relative;
			display: flex;
			// &:before {
			// 	content: '';
			// 	position: absolute;
			// 	height: 1px;
			// 	background: #EEEEEE;
			// 	left: 30upx;
			// 	right: 0;
			// 	bottom: 0;
			// 	transform: scaleY(0.5);
			// }
			.biaoshi {
				width: 72rpx;
				font-size: 72rpx;
				font-weight: bold;
			}

			// text {
			// 	display: block;
			// 	font-size: 60upx;
			// 	color: #333;
			// 	font-weight: bold;
			// 	float: left;
			// 	line-height: 70upx;
			// }

			/deep/.u-input {
				
				// display: block;
				width: 100%;
				height: 80upx;
				font-size: 80upx !important;
				line-height: 80upx;
				padding: 0 30upx;
			}
			/deep/.uni-input-input {
				font-size: 80rpx;
				line-height: 80rpx;
				font-size: 80rpx;
			}
			/deep/.u-input__input {
				font-size: 80rpx;
			}
			/deep/.u-input__right-icon {
				// line-height: 80rpx !important;
				transform: translateY(-15rpx);
			}
			/deep/.uni-input-placeholder {
				height: 80rpx !important;
				font-size: 80rpx;
			}
			.min {
				width: 40%;
				display: inline-block;
				float: right;
			}

		}

		.tx_yue {
			width: 100%;
			height: auto;
			padding: 0 30upx;
			line-height: 87upx;
			font-size: 24upx;
			color: #999999;

			

			text {
				font-size: 24upx;
				color: #EB5D03 !important;
				margin-left: 10upx;
			}
			.min {
				margin-left: 80upx;
				color: #006747 !important;
			}
		}
	}
</style>
